﻿using Bussiness.Abstracts;
using CommonLayer;
using DataAccess;
using DataAccess.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bussiness
{
    public class InvoiceManager : BaseEntityManager<InvoiceType>
    {
        private IInvoiceAccess invoiceAccess;
        public InvoiceManager(EntegrationObjects pEntegrationObject)
        {
            invoiceAccess = InvoiceAccess.CreateInstance(pEntegrationObject);
        }

        protected override InvoiceType GetEntity(InvoiceId pId)
        {
            var invoice = invoiceAccess.GetEntity(pId);
            var invoiceType = new InvoiceType();

            invoiceType.ProfileID = new ProfileIDType { Value = invoice.ProfileId };
            invoiceType.UBLVersionID = new UBLVersionIDType { Value = GlobalVariables.UBLVersionID };
            invoiceType.CustomizationID = new CustomizationIDType { Value = GlobalVariables.CustomizationID };

            return invoiceType;
        }
    }
}
